<template>
  <div>
    <!-- // 轮播 -->
    <Carousel v-if="carouselList.length" :list="carouselList" />
    <!-- //协会资讯 -->
    <AssociationNews v-if="news.length" :list="news" />
    <!-- //会员资讯 -->
    <VipNews v-if="vipList.length==10000000" :list="vipList" />
    <!-- //协会活动 -->
    <AssociationActivity v-if="activityList.length" :list="activityList" />
    <!-- //摘要 -->
    <Abstract />
  </div>
</template>
<script >
import Carousel from "@/components/Carousel";
import AssociationNews from "@/components/AssociationNews";
import Abstract from "@/components/Abstract";
import AssociationActivity from "@/components/AssociationActivity";
import VipNews from "@/components/VipNews";
import api from "@/api/modules/home.js";
export default {
  components: {
    AssociationNews,
    Abstract,
    AssociationActivity,
    VipNews,
    Carousel,
  },
  data() {
    return {
      carouselList: [], //轮播图数据
      news: [], //协会资讯
      vipList: [], // 会员资讯
      activityList: [], //协会活动
    };
  },
  mounted() {
    // 获取轮播图
    api.getCarouselList().then((res) => {
      if (res.data && res.data.length) {
        this.carouselList = res.data.filter((item) => {
          return item.moduleType==1;
        });
      }
    });
    // 获取协会资讯
    api.getAssociationFrontPage().then((res) => {
      if (res.data && res.data.length) {
        this.news = res.data.filter((item, index) => {
          return index < 8;
        });
      }
    });

    // 获取会员资讯
    api.getVipFrontPage().then((res) => {
      if (res.data && res.data.length) {
        this.vipList = res.data.filter((item, index) => {
          return index < 9;
        });
      }
    });
    //获取协会活动
    api.getActivityIndex().then((res) => {
      if (res.data && res.data.length) {
        this.activityList = res.data.filter((item, index) => {
          return index < 6;
        });
      }
    });
  },
  methods: {},
};
</script>
<style lang="less" scoped>
</style>